{extend name='admin@main'}

{block name="button"}
<!--{if auth("currency/article/add")}-->
<button data-open='{:url("add")}' data-title="添加文章" class='layui-btn layui-btn-sm layui-btn-primary'>添加文章</button>
<!--{/if}-->
<!--{if auth("currency/article/remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除文章</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='article/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='text-left nowrap'>标题</th>
            <th class='text-left nowrap'>状态</th>
            <th class='text-left nowrap'></th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class='text-left nowrap'>
                {$vo.title|default='--'}
            </td>
            <td class='text-left nowrap'>
                <div class="inline-block">
                    {if $vo.status eq 1}<strong class="color-green">正常</strong>{elseif $vo.status eq 0}<strong class="color-red">已禁用</strong>{/if}<br>
                </div>
            </td>
            <td class='text-left'>{$vo.create_at}</td>
            <td class="text-left">
                {if auth("currency/article/edit")}
                <a data-dbclick data-title="编辑文章" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}' data-value="id#{$vo.id};status#0">编 辑</a>
                {/if}

                {if $vo.status eq 1 and auth("currency/article/forbid")}
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('currency/article/forbid')}">禁 用</a>
                {elseif $vo.status eq 0 and auth("currency/article/resume")}
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('currency/article/resume')}">启 用</a>
                {/if}

                {if auth("currency/article/remove")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该用户吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('currency/article/remove')}">删 除</a>
                {/if}

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}